<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>商品管理 - 评论列表</title>
<?php include($this->c['_homes']['_viewsHome'].'/_global/_head.php');?>
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/head.php');?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container" > 
  <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
  <?php include($this->c['_homes']['_viewsHome'].'/_global/menu.php');?>
  <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR --> 
  <!-- BEGIN PAGE -->
  <div class="page-content"> 
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title"> 评论列表 </h3>
        <ul class="page-breadcrumb breadcrumb">
          <li> <i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i> </li>
          <li> 商品管理 <i class="icon-angle-right"></i> </li>
          <li>评论列表</li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB--> 
      </div>
    </div>
    <!-- END PAGE HEADER--> 
    <!-- BEGIN PAGE CONTENT--> 
    <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
    <div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
            <h4 class="modal-title">Modal title</h4>
          </div>
          <div class="modal-body"> Widget settings form goes here </div>
          <div class="modal-footer">
            <button type="button" class="btn blue submit_btn">确定</button>
            <button type="button" class="btn default" data-dismiss="modal">取消</button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
    <!-- /.modal --> 
    <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
    <div class="row">
      <div class="col-md-12">
        <div class="portlet box">
          <div class="booking-search">
            <form action="" role="form" method="get">
              <div class="row form-group">
                <div class="col-md-3">
                  <div class="input-cont">
                    <input class="form-control" name="keyword" placeholder="商品名称/编号" value="<?=$_GET['keyword'];?>" type="text">
                  </div>
                </div>

                <div class="col-md-2">
                  <select class="form-control" name="stat">
                    <option value="">全部</option>
                    <option value="1"<? if($this->data['para']['stat']==1) echo ' selected';?>>隐藏</option>
                    <option value="2"<? if($this->data['para']['stat']==2) echo ' selected';?>>显示</option>
                  </select>
                </div>
                <div class="col-md-1">
                  <input type="submit" class="btn blue btn-block" value="搜 索">
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN SAMPLE TABLE PORTLET-->
        <div class="portlet box blue">
          <div class="portlet-title">
            <div class="caption"><i class="icon-list"></i>列表(<?=$this->data['count'];?>)</div>
            <div class="actions">
              <div class="btn-group"> <a class="btn red" href="#" data-toggle="dropdown"> <i class="icon-cog"></i> 批量操作 <i class="icon-angle-down"></i> </a>
                <ul class="dropdown-menu pull-right">
                  <li><a href="javascript:_batch('delete');"><i class="i"></i> 删除</a></li>
                </ul>
              </div>
            </div>
          </div>
          <div class="portlet-body">
            <div class="table-scrollable">
             <table class="table table-striped table-bordered table-hover dataTable">
                <thead>
                  <tr>
                    <th><input type="checkbox" id="_checkboxall" value="1"></th>
                    <th>评论ID</th>
                    <th>商品名称</th>
                    <th>星级评论</th>
                    <th>评论内容</th>
                    <th>评论人</th>
                    <th>评论状态</th>
                  </tr>
                </thead>
                <tbody>
                <?php if ($this->data['data']){
                        foreach ($this->data['data'] as $v){
                ?>
                 <tr>
                    <td><input type="checkbox" class="_checkboxs" name="id[]" value="<?=$v['id'];?>"></td>
                    <td><?=$v['id'];?></td>
                    <td><?=$v['goods_name'];?></td>
                    <td>
                       <?php if ($v['lev'] == 1){echo "一星";}?>
                       <?php if ($v['lev'] == 2){echo "二星";}?>
                       <?php if ($v['lev'] == 3){echo "三星";}?>
                       <?php if ($v['lev'] == 4){echo "四星";}?>
                       <?php if ($v['lev'] == 5){echo "五星";}?>
                    </td>
                    <td><?=$v['note'];?></td>
                    <td><?=$v['nickname'];?></td>
                    <td><a href="#" class="btn btn-xs blue" onclick="editstat(this,<?=$v['id'];?>)">
                       <i class="icon-edit"></i>
                      <?php if ($v['stat'] == 1){echo "隐藏";}?>
                      <?php if ($v['stat'] == 2){echo "显示";}?>
                      </a>
                    </td>
                 </tr>
                 <?php } }?>
                </tbody>
              </table>
            </div>
          </div>
        </div>
        <?php
		if($this->data['maxpage'] > 1){
		?>
        <div>
          <ul class="pagination">
            <?
			$pquery="?";		
			if($this->data['para']){			
				foreach($this->data['para'] as $k=>$r){				
					$pquery.=$k."=".$r."&";
					$form_hidden .= '<input type="hidden" name="'.$k.'" value="'.$r.'">';
				}			
			}
			
			if($this->data['page'] > 1) echo '<li><a href="'.$pquery.'page='.($this->data['page']-1).'"><i class="icon-angle-left"></i></a></li>';
			for($i = $this->data['spage']['ps']; $i<=$this->data['spage']['pe']; $i++){
			if($i == $this->data['page']) echo '<li class="disabled"><a href="javascript:void(0);">'.$i.'</a></li>';
			else echo '<li><a href="'.$pquery.'page='.$i.'">'.$i.'</a></li>';
			}
			
			if($this->data['page'] < $this->data['maxpage']) echo '<li><a href="'.$pquery.'page='.($this->data['page']+1).'"><i class="icon-angle-right"></i></a></li>';
			?>
          </ul>
          <div class="jumppage">
          <form method="get" action="">
          <?=$form_hidden;?>
          页码：<?=$this->data['page'];?>/<?=$this->data['maxpage'];?>
          跳到 <input type="text" name="page" class="value"> 页          
          <input type="submit" value="GO" class="sub">
          </form>
          </div>
        </div>
        <?
 		}
?>
        <!-- END SAMPLE TABLE PORTLET--> 
      </div>
    </div>
    <!-- END PAGE CONTENT--> 
  </div>
  <!-- END PAGE --> 
</div>
<!-- END CONTAINER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/_footer.php');?>
<script>
    jQuery(document).ready(function() {    
       App.init();
    });
</script>
<script>
function editstat(obj,id){
	if(confirm("你确定要修改吗？"))
	{
		$.ajax({
		    type: 'post',
		    url: '/goods/AjaxStat',
		    data: "id="+encodeURI(id)+"&mr="+Math.random(),
		    success: function(msg) {
				if(msg!=""){
					var _data=eval("("+msg+")");
					if(_data.code == 200){
						if(_data.msg == 2){
							$(obj).html('<i class="icon-edit"></i>&nbsp;显示');
						}
						if(_data.msg == 1){
							$(obj).html('<i class="icon-edit"></i>&nbsp;隐藏');
						}
					}else{
						alert(_data.msg);
					}
				}
		    }
		});
	}
}
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>